import request from '@/utils/request'

const baseUrl = process.env.NODE_ENV === 'production' ? '' : '/vehicleMap'

export function listCar(query) {
  return request({
    url:baseUrl+'/device/list',
    method: 'get',
    params: query
  })
}

export function exportcar(query) {
  return request({
    url:baseUrl+ '/device/export',
    method: 'get',
    params: query
  })
}

export function fetchPv(pv) {
  return request({
    url:baseUrl+ '/vue-element-admin/article/pv',
    method: 'get',
    params: { pv }
  })
}

export function addCar(data) {
  return request({
    url:baseUrl+ '/car',
    method: 'post',
    data
  })
}

export function updateCar(data) {
  return request({
    url:baseUrl+ '/car',
    method: 'put',
    data
  })
}

export function deleteCar(data) {
    return request({
      url:baseUrl+ '/car/delete',
      method: 'delete',
      data
    })
  }

export function getlclock(pageNo,pageSize) {

    return request({
      url:baseUrl+ `/lclock`,
      method: 'get',
      params:{
        pageNo,
        pageSize,
     //   sort:"+id"
      }
    })
  }


  // export function loadFeedbackApi(pageNo, pageSize) {
  //   return request({
  //     url:baseUrl+ "/lcparkfield",
  //     method: "get",
  //     params: {
  //       pageNo: pageNo,
  //       pageSize: pageSize
  //     }
  //   })
  // }


  export function loadFeedbackApi(params) {
    return request({
      url:baseUrl+ "/lcparkfield",
      method: "get",
      params: params
    });
  }

  export function loadlockApi(params) {
    return request({
      url:baseUrl+ "/lclock",
      method: "get",
      params: params
    });
  }

  export function loadorderApi(params) {
    return request({
      url:baseUrl+ "/lcchargerlog/listLcChargerLogDetails",
      method: "get",
      params: params
    });
  }


  export function loadinvoiceApi(params) {
    return request({
      url:baseUrl+ "/lcinvoice",
      method: "get",
      params: params
    });
  }

  export function loadfundApi(params) {
    return request({
      url:baseUrl+ "/lcchargerlog/incomeByLcChargerLog",
      method: "get",
      params: params
    });
  }

  export function loadcustomerApi(params) {
    return request({
      url:baseUrl+ "/lcuser/listUserByroleCode",
      method: "get",
      params: params
    });
  }

  export function batchChange(multipleSelection, status , type ,price) {
    let ids = new Array();
    for(let i=0;i<multipleSelection.length;i++){
        ids[i] = multipleSelection[i].lockId
    }
    const data = {
        ids,
        price,
        status,
        type
    }
    return request({
        url:baseUrl+'/lclock',
        method: 'put',
        data
    })
    
}

export function batchChange2(multipleSelection, status , type ,price) {
  let ids = new Array();
  ids.push(multipleSelection);

  const data = {
      ids,
      price,
      status,
      type
  }
  return request({
      url:baseUrl+'/lclock',
      method: 'put',
      data
  })
  
}

export function updateParkfieldApi(form) {
  return request({
    url:baseUrl+"/lcparkfield",
    method: "put",
    data: form
  })
}


export function batchUpdatePriceApi(editdata) {

  const data = editdata
  return request({
    url:baseUrl+'/updateLcParkfield',
    method: 'put',
    data: data
  })
}

export function getPriceBylockApi(params) {

  return request({
    url:baseUrl+'lclock/getPriceBylock',
    method: 'get',
    params: params
  })
}


export function listLcOccLogDetailsApi(params) {

  return request({
    url:baseUrl+'/lcchargerlog/listLcOccLogDetails',
    method: 'get',
    params: params
  })
}







